/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sessionbean;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import supportlearning.entities.StaffProfile;
import supportlearning.entities.StudentProfile;

/**
 *
 * @author Huy
 */
@Stateless
public class StudentProfileFacade extends AbstractFacade<StudentProfile> implements StudentProfileFacadeLocal {

    @PersistenceContext(unitName = "EprojectCMSSupportLearning-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public List<StudentProfile> findbyclassname(int id) {
        Query q = em.createQuery("SELECT s FROM StudentProfile s WHERE s.cMSClass.classId = :a");
        q.setParameter("a", id);
        List<StudentProfile> liststupro = q.getResultList();
        return liststupro;
    }
 @Override
    public StudentProfile findStuByID(String id) {
        return em.find(StudentProfile.class, id);
    }
    public StudentProfileFacade() {
        super(StudentProfile.class);
    }
}
